package com.jiyun.controller;

import com.jiyun.pojo.Announcement;
import com.jiyun.service.AnnouncementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/announcement")
public class AnnouncementController {
    @Autowired
    private AnnouncementService announcementService;
    // 展示所有
    @GetMapping("/list")
    public List<Announcement> list(){
        List<Announcement> list = announcementService.findAll();
        return list;
    }
    @GetMapping("findOne")
    public Announcement findOne(Integer id){
        Announcement one = announcementService.getById(id);
        return one;
    }
}
